1. Technical Field
The present invention generally relates to software development tools, and more specifically to a way to write software source files at a high level of abstraction and selectively implement, compile or otherwise convert to concrete code and documentation on the basis of annotations within the highly abstract file.
2. Description of Related Art
Annotations are tracts of text that are added to source files, e.g. Java type source, that may be processed to generate artifacts. Artifacts may include other source files of the same or a different language, and metadata. Metadata includes information which describes the original file or produced artifacts. Metadata may include information which is machine and/or human readable. Examples of metadata include deployment descriptors for Java 2 Enterprise Edition applications and modules or documentation produced by the Javadoc tool.
Among the files that annotations may drive the creation of, are: Enterprise JavaBeans (EJBs), Java Data Objects (JDO), Java Servlets, Java Management Extensions (JMX), and Remote Method Invocation (RMI) artifacts. The use of annotations allows integration of information related to but not explicitly specified by source code, which can lower the maintenance costs associated with the source files.
In the case of the Java programming language, there are two modes of annotation. In the first form, annotations are embedded into source file comments. In the second form, annotations are embedded into the space reserved for the Java language reserved words.
The Javadoc tool distributed as part of the Java specification provides an example of annotations in the first form. A sample of a Javadoc annotation is shown in the following excerpt from a Java file. The annotation is embedded in the comment which is set off at the beginning by the text “/**”, and at the end by “*/”.
/** @param p1 The first parameter of the method @return Astring of interesting information @throws IOException if the disk is inaccessible*/public String method(Object p1){
Annotations are of particular benefit when using Java 2 Enterprise Edition (J2EE) applications for the generation of Enterprise Java Bean (EJB) metadata used in deployment.
Annotations are a convenient and systematic way to attach information to program elements that may be automatically extracted. Extraction may be done by tools that create artifacts, some of which may be in an XML format.
Among the benefits of annotations, is the ability to create various software-development artifacts, including documentation, from a concise, core, Java file. Because there are often alternate environments that a Java file must be compiled and/or configured to operate, annotations may be used to specify how the Java file itself must be processed to create the artifacts necessary for each environment. For example, some annotations may relate only to code development that targets Enterprise Java Bean (EJB). Thus some annotations may be relevant to EJB. In other situations, some annotations may relate only to code development that targets Web Services. In the foregoing example, a common Java file would have at least two sets of annotations, wherein each logical group associated by function is known as a tagset. A tagset is a collection of annotations which are associated with a particular type of generated artifacts and/or metadata. Thus a developer could have a tagset for Web Services, and another tagset for EJB.
Currently software development tools process all annotations. This, unfortunately, forces a developer to redact annotations for the non-preferred tagset—essentially destroying an option that could be useful later, or even worse, requiring a developer to keep, update and revise at least two different Java files for the same project. In practice, this proves inefficient and redundant—sometimes confusing the developer and making extra work.
In view of the foregoing, there exists a need for selecting tagsets of annotations before or during the processing of Java files.